package com.huawei.appmarket.service.store.awk.card;

import android.app.Activity;
import android.content.Context;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.huawei.appgallery.foundation.card.base.card.BaseDistCard;
import com.huawei.appgallery.foundation.card.gamereserve.bean.BaseDecorateAppCardBean;
import com.huawei.appgallery.foundation.ui.framework.cardframe.bean.BaseCardBean;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import huawei.widget.HwTextView;
import o.azb;
import o.ccz;
import o.cdh;
import o.cii;
import o.cil;
import o.cim.a;
import o.dky.c;
import o.dof;
import o.epv;
import o.evx;
import o.ewm.d;
import o.ewm.h;
import o.ewm.j;

public class BaseDecorateAppCard extends BaseDistCard {
    private int ʻ = ccz.ॱ();
    protected HwTextView ʽ;
    protected HwTextView ˋ;
    protected View ᐝ;

    public BaseDecorateAppCard(Context context) {
        super(context);
        if (context instanceof Activity) {
            this.ʻ = cdh.ˎ((Activity) this.ʼॱ);
        }
    }

    public void ˏ(CardBean cardBean) {
        super.ˏ(cardBean);
        if (cardBean instanceof BaseDecorateAppCardBean) {
            ˋ((BaseDecorateAppCardBean) cardBean);
        }
    }

    protected void ˋ(final BaseDecorateAppCardBean baseDecorateAppCardBean) {
        ॱ(baseDecorateAppCardBean);
        if (!ˊ(baseDecorateAppCardBean)) {
            ˊ(this.ᐝ, 8);
        } else if (ˊ()) {
            ˊ(this.ᐝ, 0);
            this.ʽ.setText(baseDecorateAppCardBean.ʻˊ());
            this.ᐝ.setOnClickListener(new evx(this) {
                final /* synthetic */ BaseDecorateAppCard ˋ;

                public void ˋ(View view) {
                    cil.ˋ(this.ˋ.ʼॱ, new a().ˎ(this.ˋ.ˎ()).ˊ(baseDecorateAppCardBean.ॱॱ()).ˏ(String.valueOf(this.ˋ.ʻ)).ˋ());
                    Object ʻˋ = baseDecorateAppCardBean.ʻˋ();
                    if (!TextUtils.isEmpty(ʻˋ)) {
                        BaseCardBean baseCardBean = new BaseCardBean();
                        baseCardBean.ॱ(ʻˋ);
                        baseCardBean.ˉ(baseDecorateAppCardBean.ͺˏ());
                        cii.ˊ().ˋ(this.ˋ.ʼॱ, baseCardBean);
                    }
                }
            });
        }
    }

    private boolean ˊ() {
        if (this.ᐝ == null) {
            if (!(this.ˊˋ instanceof ViewGroup)) {
                return false;
            }
            this.ᐝ = LayoutInflater.from(this.ʼॱ).inflate(h.ॱˉ, (ViewGroup) this.ˊˋ, false);
            this.ʽ = (HwTextView) this.ᐝ.findViewById(j.ˊʿ);
            ((ViewGroup) this.ˊˋ).addView(this.ᐝ);
            ˋ();
        }
        return true;
    }

    private void ॱ(BaseDecorateAppCardBean baseDecorateAppCardBean) {
        if (dof.ॱ(baseDecorateAppCardBean.ʼˋ())) {
            ˊ(this.ˋ, 8);
            return;
        }
        this.ˋ.setText(baseDecorateAppCardBean.ʼˋ());
        ˊ(this.ˋ, 0);
    }

    private void ˊ(View view, int i) {
        if (view != null) {
            view.setVisibility(i);
        }
    }

    protected void ˋ() {
        this.ᐝ.setPaddingRelative((epv.ˊ() + this.ʼॱ.getResources().getDimensionPixelSize(c.ॱᐝ)) + this.ʼॱ.getResources().getDimensionPixelSize(d.ॱˊ), this.ᐝ.getPaddingTop(), this.ᐝ.getPaddingEnd(), this.ᐝ.getPaddingBottom());
        azb.ˏ(this.ᐝ);
    }

    protected String ˎ() {
        return "";
    }

    protected boolean ˊ(BaseDecorateAppCardBean baseDecorateAppCardBean) {
        return false;
    }
}
